package com.cy.pet.item.controller;

import com.cy.pet.common.pojo.Item;
import com.cy.pet.common.service.ItemDescService;
import com.cy.pet.common.vo.SysResult;
import com.cy.pet.item.annotation.BrowseLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: LiuXingYu
 * @date: 2021/10/8 10:09
 */

@RestController
@RequestMapping("/itemDesc")
public class ItemDescController {
    @Autowired
    private ItemDescService itemDescService;
    private Integer id;
    /*http://localhost:8201/itemDesc/getId/5*/
    /*设置要查询的商品id*/
    @GetMapping("/getId/{id}")
    public void getId(@PathVariable Integer id){
        this.id = id;
        System.out.println(id);
    }
    /*http://localhost:8201/itemDesc/getById*/
    /*根据id查询商品信息*/
    @BrowseLog
    @GetMapping("/getById")
    public SysResult getItemDescById(){
        Item item = itemDescService.getItemDescById(id);
        return SysResult.success(item);
    }

}

